package com.sxbbc.common.core.enums;

import com.sxbbc.common.basics.utils.calculation.CalcuUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 商品计价方式枚举类
 * @author leehao
 * @date 2019-05-29
 */
public enum ValuationTypeEnums {
    AMOUNT(1,"数量计价"),
    WEIGHT(2,"重量计价");

    private Integer id;
    private String name;

    ValuationTypeEnums(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static List<ValuationTypeEnums> queryList(){
        List<ValuationTypeEnums> list=new ArrayList<ValuationTypeEnums>();
        for(ValuationTypeEnums o: ValuationTypeEnums.values()){
            list.add(o);
        }
        return list;
    }

    public static String getName(Integer id){
        String str="";
        for(ValuationTypeEnums o:ValuationTypeEnums.values()){
            if(CalcuUtils.getInstance().isEquals(id, o.getId())){
                str= o.getName();
                break;
            }
        }
        return str;
    }
}
